:root {
    --primary-color: #4d5eff;
    --primary-dark: #3a49d9;
    --secondary-color: #ff7a50;
    --secondary-dark: #e56a43;
    --success-color: #4caf50;
    --warning-color: #ffa000;
    --error-color: #f44336;
    --background-color: #f9f9fb;
    --card-color: #ffffff;
    --text-color: #333333;
    --text-secondary: #666666;
    --border-color: #e0e0e0;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
    --border-radius: 10px;
    --card-border-radius: 16px;
    --button-border-radius: 8px;
}

.dark-theme {
    --primary-color: #667aff;
    --primary-dark: #5567e6;
    --background-color: #121212;
    --card-color: #1e1e1e;
    --text-color: #e0e0e0;
    --text-secondary: #b0b0b0;
    --border-color: #333333;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    transition: var(--transition);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.theme-toggle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--card-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.theme-toggle:hover {
    background-color: var(--primary-color);
    color: white;
}

/* Game Container Styles */
.game-container {
    background-color: var(--card-color);
    border-radius: var(--card-border-radius);
    box-shadow: var(--shadow-md);
    padding: 30px;
    margin-bottom: 40px;
    position: relative;
    overflow: hidden;
}

.game-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
}

.timer, .score {
    display: flex;
    align-items: center;
    font-size: 1.25rem;
    font-weight: 600;
    padding: 8px 16px;
    background-color: var(--background-color);
    border-radius: var(--button-border-radius);
    box-shadow: var(--shadow-sm);
}

.timer i, .score i {
    margin-right: 10px;
    color: var(--primary-color);
}

/* Welcome Screen Styles */
.welcome-screen {
    text-align: center;
    padding: 40px 20px;
}

.welcome-screen h2 {
    font-size: 2rem;
    margin-bottom: 15px;
    color: var(--primary-color);
}

.welcome-screen p {
    font-size: 1.1rem;
    margin-bottom: 30px;
    color: var(--text-secondary);
}

.difficulty-selector {
    margin-bottom: 30px;
}

.difficulty-selector h3 {
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.difficulty-options {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.difficulty-btn {
    padding: 10px 20px;
    border: 2px solid var(--border-color);
    border-radius: var(--button-border-radius);
    background-color: transparent;
    color: var(--text-color);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.difficulty-btn:hover, .difficulty-btn.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Button Styles */
.primary-btn, .secondary-btn, .control-btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--button-border-radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.primary-btn {
    background-color: var(--primary-color);
    color: white;
}

.primary-btn:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.secondary-btn {
    background-color: var(--background-color);
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}

.secondary-btn:hover {
    background-color: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

.control-btn {
    background-color: var(--background-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    font-size: 0.9rem;
}

.control-btn:hover {
    background-color: var(--card-color);
    box-shadow: var(--shadow-sm);
}

.control-btn i {
    margin-right: 5px;
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Game Play Styles */
.game-play {
    text-align: center;
}

.cards-container {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.number-card {
    width: 100px;
    height: 140px;
    border-radius: 10px;
    background-color: var(--card-color);
    box-shadow: var(--shadow-md);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    border: 2px solid var(--border-color);
    position: relative;
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
    transform-style: preserve-3d;
}

.number-card:hover {
    transform: translateY(-5px) rotateY(10deg);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.number-card.selected {
    border-color: var(--secondary-color);
    background-color: rgba(255, 122, 80, 0.1);
    transform: scale(1.05);
}

.number-card.result {
    background-color: rgba(77, 94, 255, 0.1);
    color: var(--secondary-color);
}

.operations {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 30px;
}

.op-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: var(--background-color);
    color: var(--text-color);
    font-size: 1.5rem;
    font-weight: 600;
    border: 2px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
}

.op-btn:hover {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: scale(1.1);
}

.op-btn.selected {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: scale(1.1);
}

.calculation-area {
    margin-bottom: 30px;
}

.expression-display {
    background-color: var(--background-color);
    padding: 15px;
    border-radius: var(--border-radius);
    margin-bottom: 15px;
    font-size: 1.1rem;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.game-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
}

/* Result Styles */
.game-result {
    padding: 40px 20px;
    text-align: center;
}

.result-content {
    max-width: 500px;
    margin: 0 auto;
}

.result-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.success .result-icon {
    color: var(--success-color);
}

.failure .result-icon {
    color: var(--error-color);
}

.result-content h2 {
    font-size: 2rem;
    margin-bottom: 10px;
}

.result-details {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin: 30px 0;
    color: var(--text-secondary);
}

.time-taken, .moves-taken {
    display: flex;
    align-items: center;
    font-size: 1.1rem;
}

.time-taken i, .moves-taken i {
    margin-right: 8px;
    color: var(--primary-color);
}

.solution-container {
    margin: 20px 0;
}

.solution-display {
    margin-top: 15px;
    padding: 15px;
    background-color: var(--background-color);
    border-radius: var(--border-radius);
    font-family: monospace;
    text-align: left;
}

/* Tutorial Overlay */
.tutorial-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.tutorial-content {
    background-color: var(--card-color);
    border-radius: var(--card-border-radius);
    padding: 40px;
    max-width: 600px;
    width: 90%;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
}

.tutorial-content h2 {
    text-align: center;
    margin-bottom: 30px;
    color: var(--primary-color);
}

.tutorial-steps {
    margin-bottom: 30px;
}

.tutorial-step {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.step-number {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    margin-right: 15px;
    flex-shrink: 0;
}

.tutorial-example {
    background-color: var(--background-color);
    padding: 20px;
    border-radius: var(--border-radius);
    margin-bottom: 30px;
}

.tutorial-example h3 {
    margin-bottom: 10px;
    color: var(--primary-color);
}

/* Stats Section */
.stats-section, .history-section {
    margin-bottom: 40px;
}

.stats-section h2, .history-section h2 {
    margin-bottom: 20px;
    font-size: 1.8rem;
    color: var(--primary-color);
}

.stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.stat-card {
    background-color: var(--card-color);
    border-radius: var(--card-border-radius);
    padding: 20px;
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: rgba(77, 94, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
    font-size: 1.5rem;
    margin-right: 15px;
}

.stat-info h3 {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.stat-info p {
    font-size: 1.5rem;
    font-weight: 600;
}

/* History Table */
.history-table-container {
    background-color: var(--card-color);
    border-radius: var(--card-border-radius);
    padding: 20px;
    box-shadow: var(--shadow-md);
    overflow-x: auto;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
}

.history-table th, .history-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.history-table th {
    font-weight: 600;
    color: var(--primary-color);
}

.history-table tr:last-child td {
    border-bottom: none;
}

.history-table tr:hover {
    background-color: var(--background-color);
}

/* Footer */
footer {
    background-color: var(--card-color);
    padding: 20px;
    text-align: center;
    border-top: 1px solid var(--border-color);
}

footer a {
    color: var(--primary-color);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }

    .difficulty-options {
        flex-direction: column;
        gap: 10px;
    }

    .number-card {
        width: 80px;
        height: 120px;
        font-size: 1.75rem;
    }

    .operations {
        flex-wrap: wrap;
    }

    .op-btn {
        width: 50px;
        height: 50px;
        font-size: 1.25rem;
    }

    .tutorial-content {
        padding: 30px 20px;
    }

    .stats-cards {
        grid-template-columns: 1fr;
    }
}

/* Animation Classes */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.animate-fadeIn {
    animation: fadeIn 0.5s ease forwards;
}

.animate-slideIn {
    animation: slideIn 0.5s ease forwards;
}

.animate-pulse {
    animation: pulse 1.5s infinite;
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; } 